/*
** StockDB
**
** Copyright (C) 2012 - ? doublegsoft
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __REQUEST_H__
#define __REQUEST_H__

/*!
** TODO
*/
typedef struct reqbuf_t
{
  int remote;
  int length;
  char *data;
  struct reqbuf_t *next;
} reqbuf_t;

/*!
** Creates a new reqbuf_t structure.
**
** @param[in] remote
**              socket file descriptor for remote client
**
** @return a created reqbuf_t
*/
reqbuf_t *
stockdb_create_reqbuf(int remote);

/*!
** Finds reqbut_t in buffer list of server size.
**
** @param[in] remtoe
**              socket file descriptor for remote client
**
** @return a found reqbuf_t
*/
reqbuf_t *
stockdb_find_reqbuf(int remote);

/*!
** Deletes a reqbuf_t in server buffer list with the given remote file
** descriptor.
**
** @param[in] remote
**              socket file descriptor for remote client
*/
void
stockdb_delete_reqbuf(int remote);

/*!
** Appends the given buf recv()ed from client in the buffer.
**
** @param[out] req
**              a found buffer
**
** @param[in] buf
**              recv()ed data
**
** @param[in] size
**              recv()ed data size
*/
void
stockdb_append_data(reqbuf_t *req, char *buf, int size);

#endif /* __REQUEST_H__ */
